package com.itheima.sh.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.sh.mapper.DockerMapper;
import com.itheima.sh.pojo.IpCount;
import com.itheima.sh.service.DockerService;
import org.springframework.stereotype.Service;

@Service
public class DockerServiceImpl extends ServiceImpl<DockerMapper, IpCount> implements DockerService {
    /**
     * 根据IP查询数据库是否有对应的ip
     * @param ip
     * @return
     */
    @Override
    public IpCount findByIp(String ip) {
        return baseMapper.findByIp(ip);
    }

    /**
     * 插入一条Ip数据到数据库
     * @param ip
     * @param count
     * @return
     */
    @Override
    public void insertByIp(String ip, int count) {
         baseMapper.insertByIp(ip,count);
    }

    /**
     * 查询访问的次数
     * @param count
     */
    @Override
    public void updateByIp(int count,String ip) {
        baseMapper.updateByIp(count,ip);
    }

    @Override
    public int getCount(String ip) {
      return  baseMapper.getCount(ip);
    }
}
